package controleur;

import java.io.IOException;

import chaineResponsablites.clientAttente.ActionClientAttenteInviter;
import envoieDeDonnees.Invitation;
import envoieDeDonnees.Reponse;
import android.content.DialogInterface;

public class ControleurInvitation implements DialogInterface.OnClickListener {
	private ActionClientAttenteInviter action;
	private boolean resultat;
	private Invitation invitation;
	
	

	public ControleurInvitation(ActionClientAttenteInviter action,
			boolean resultat, Invitation invitation) {
		super();
		this.action = action;
		this.resultat = resultat;
		this.invitation = invitation;
	}



	public ActionClientAttenteInviter getAction() {
		return action;
	}



	public void setAction(ActionClientAttenteInviter action) {
		this.action = action;
	}



	public boolean isResultat() {
		return resultat;
	}



	public void setResultat(boolean resultat) {
		this.resultat = resultat;
	}



	public void onClick(DialogInterface dialog, int which) {
		// TODO Auto-generated method stub
		try {
			action.getActivity().getOut().writeObject(new Reponse(resultat,invitation.getJoueur(),action.getActivity().getJoueur()));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
